package com.egene.zh.utils;

import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;

import com.egene.zh.R;
import com.squareup.picasso.Picasso;

/**
 * Created by WZX on 2015/8/28.
 */
public class ImageUtil {
    public static void loadImage(Context context, ImageView iv, String path){
        if (iv != null && !TextUtils.isEmpty(path)) {
            Picasso.with(context).load(path).placeholder(R.drawable.art_default).error(R.drawable.art_default).into(iv);
        }else{
            Picasso.with(context).load(R.drawable.art_default).into(iv);
        }
    }

    public static void loadImage(Context context, ImageView iv, int res){
        if (iv != null) {
            Picasso.with(context).load(res).placeholder(R.drawable.art_default).error(R.drawable.art_default).into(iv);
        }else{
            Picasso.with(context).load(R.drawable.art_default).into(iv);
        }
    }

}
